home *** CD-ROM | disk | FTP | other *** search
- /* AddressOMaticTest.h */
- /*
- * AddressOMaticTest.h
- * Copyright © 1993 Apple Computer Inc. All rights reserved.
- */
- #ifndef _AddressOMaticTest_
- #define _AddressOMaticTest_
- /*
- * These definitions are common to ReZ and code sources.
- */
- #ifdef THINK_Rez
- #define kApplicationCreator '????'
- #else
- #define kApplicationCreator '???\?'
- #endif
- #define kApplicationType 'APPL'
- #define ALRT_NonFatal (9000)
- #define ALRT_Fatal (9010)
- #define ALRT_Continue (9020)
- #define ALRT_Info (9030)
-
- #define MBAR_MenuBar (1)
- #define MENU_Apple (1)
- #define MENU_File (256)
- #define MENU_Edit (257)
-
- #define STRN_AOMLabels (128)
- #define STRN_BrowsePanelHelpStrings (129)
- #define STRN_PDPanelHelpStrings (130)
- #define STRN_FindPanelHelpStrings (131)
-
- #define HELP_Resource (0) /* TBS */
-
- #ifndef REZ
- #ifndef THINK_C /* MPW includes */
- #include <Processes.h>
- #include <Errors.h>
- #include <Finder.h>
- #include <Folders.h>
- #include <Script.h>
- #include <Types.h>
- #include <Resources.h>
- #include <QuickDraw.h>
- #include <Fonts.h>
- #include <Events.h>
- #include <Windows.h>
- #include <Menus.h>
- #include <TextEdit.h>
- #include <Dialogs.h>
- #include <Desk.h>
- #include <ToolUtils.h>
- #include <Memory.h>
- #include <Files.h>
- #include <OSUtils.h>
- #include <OSEvents.h>
- #include <DiskInit.h>
- #include <Packages.h>
- #include <Traps.h>
- #include <Lists.h>
- #endif
- #include <GestaltEqu.h>
- #include <OCE.h>
- #include <OCEAuthDir.h>
- #include <OCEStandardDirectory.h>
- #include <OCEErrors.h>
- /*
- * OCEStandardMail is not used - it's here to simplify browsing
- * the header files from the Think C editor.
- */
- #include <OCEStandardMail.h>
- #include "AddressOMatic.h"
- #include "LogManager.h"
-
- #ifndef EXTERN
- #define EXTERN extern
- #endif
- #ifndef TRUE
- #define TRUE 1
- #define FALSE 0
- #endif
- #ifndef NULL
- #define NULL 0
- #endif
- #ifndef topLeft
- #define topLeft(rect) (((Point *) &(rect))[0])
- #define botRight(rect) (((Point *) &(rect))[1])
- #endif
-
- #ifndef __CharCodesDefined__
- #define __CharCodesDefined__
- enum { /* Keyboard commands */
- NUL = 0,
- kOpenDoubleQuote = 0xD2,
- kCloseDoubleQuote = 0xD3,
- kOpenSingleQuote = 0xD4,
- kCloseSingleQuote = 0xD5,
- /* */
- charEnter = 0x03, /* Enter key */
- charEscape = 0x1B,
- charHome = 0x01, /* Extended keyboard */
- charEnd = 0x04,
- charArrowLeft = 0x1C,
- charArrowRight = 0x1D,
- charArrowUp = 0x1E,
- charArrowDown = 0x1F,
- charPageUp = 0x0B,
- charPageDown = 0x0C,
- charHelp = 0x05
- };
- enum { /* Scroll bar constants */
- kScrollBarWidth = 16,
- kScrollBarOffset = kScrollBarWidth - 1,
- kScrollBarTweek = 2 /* Don't ask */
- };
- enum {
- kInvisibleCtrl = 0, /* contrlVis values */
- kVisibleCtrl = 0xFF
- };
- #endif
- #define MakeControlVisible(ctrl) ((**ctrl).contrlVis = kVisibleCtrl)
- #define MakeControlInvisible(ctrl) ((**ctrl).contrlVis = kInvisibleCtrl)
- /*
- * This defines the height of the non-browser stuff. These
- * occupy fixed areas below the browser.
- */
- #define kDestinationHeight 128
- #define kErrorLogHeight 64
- #define kSlop 4
- #define kPrivateWidth (kScrollBarWidth * 2)
- #define kPrivateHeight \
- (kDestinationHeight + kErrorLogHeight + kScrollBarWidth + kSlop * 3)
-
- typedef struct BrowserRecord {
- WindowRecord window;
- AddressOMaticPtr aomPtr;
- AuthIdentity userIdentity;
- ListHandle recipientLog;
- ListHandle errorLogList;
- unsigned short selectionSize;
- PackedDSSpecPtr selection;
- SMPRecipientDescriptorPtr recipientList;
- AOMPanelState whatHappened;
- Boolean wasFinding;
- Rect panelRect;
- Rect destRect;
- Rect logRect;
- } BrowserRecord, *BrowserPtr;
- #define BROWSER (*browserPtr)
- #define WINDOW (BROWSER.window)
- #define PANEL (BROWSER.aomPtr)
- #define ERROR_LOG (BROWSER.errorLogList)
- #define RESULT_LOG (BROWSER.recipientLog)
-
- /*
- * This structure is used to dump the contents of a DSSpec. To
- * use this, call UnpackPackedDSSpec with the packed DSSpec
- * and a pointer to the buffer to unpack it into. Then call
- * DisplayUnpackedDSSpec to display the contents of the unpacked
- * buffer, and, finally, DisposeDSSpecDumpRecord to delete the
- * temporary data stored in the DSSpecDumpRecord. Note: do not
- * dispose of the packed DSSpec before disposing of the dump
- * record as it contains direct pointers into the packed DSSpec.
- */
- typedef struct DSSpecDumpRecord {
- DSSpec theDSSpec;
- RecordID recordID;
- OSType specType;
- RLI theDSSpecRLI;
- unsigned short nodeNameCount;
- unsigned short unpackedNodeNameCount;
- RStringPtr *partsVector;
- /*
- * These Boolean values record the status of the DSSpec. They
- * are TRUE if their associated part of the structure is
- * present and in good condition.
- */
- Boolean isValidDSSpec;
- Boolean isNonNullRLI;
- Boolean isValidPackedRLI;
- Boolean isValidPackedPathName;
- Boolean isValidPartsVector;
- Boolean isValidUnpackedNodeNameCount;
- } DSSpecDumpRecord, *DSSpecDumpPtr;
-
-
- /*
- * Write data to the result log
- */
- #define NOTE(msg) do { \
- DisplayLogString(BROWSER.recipientLog, (msg)); \
- } while (0)
- #define LOG_OSType(msg, ostype) do { \
- Str255 __work; \
- OSType __datum; \
- unsigned char __value[5]; \
- pstrcpy(__work, (msg)); \
- __datum = (ostype); \
- BlockMove(&__datum, &__value[1], sizeof (OSType)); \
- __value[0] = sizeof (OSType); \
- pstrcat(__work, "\p = '"); \
- pstrcat(__work, __value); \
- pstrcat(__work, "\p'"); \
- DisplayLogString(BROWSER.recipientLog, __work); \
- } while (0)
- #define LOG_Value(msg, data) do { \
- Str255 __work; \
- Str15 __value; \
- pstrcpy(__work, (msg)); \
- NumToString((data), __value); \
- pstrcat(__work, "\p = "); \
- pstrcat(__work, __value); \
- DisplayLogString(BROWSER.recipientLog, __work); \
- } while (0)
-
- #define LOG_RString(msg, data) do { \
- Str255 __work; \
- pstrcpy(__work, (msg)); \
- pstrcat(__work, "\p “"); \
- pstrcat(__work, OCERToPString((data))); \
- pstrcat(__work, "\p”"); \
- DisplayLogString(BROWSER.recipientLog, __work); \
- } while (0)
-
- BrowserPtr IsOurWindow(
- WindowPtr theWindow
- );
- void BalloonHelp(
- register WindowPtr theWindow
- );
- /*
- * AddressOMatic test functions
- */
- void DecorateWindow(
- register BrowserPtr browserPtr
- );
- void DisposeAddressOMatic(
- register BrowserPtr browserPtr
- );
-
- void UnpackPackedDSSpec(
- register BrowserPtr browserPtr,
- PackedDSSpecPtr packedDSSpecPtr,
- register DSSpecDumpPtr theDSSpecDumpPtr
- );
- void DisplayUnpackedDSSpec(
- register BrowserPtr browserPtr,
- register DSSpecDumpPtr theDSSpecDumpPtr
- );
- void DisposeDSSpecDumpRecord(
- register BrowserPtr browserPtr,
- register DSSpecDumpPtr theDSSpecDumpPtr
- );
-
- /*
- * Window utilities (not specific to AddressOMatic Test)
- */
- void DoZoomWindow(
- WindowPtr theWindow,
- short whichPart
- );
- Boolean DoGrowWindow(
- WindowPtr theWindow,
- short minimumWidth,
- short minimumHeight
- );
- void MyDrawGrowIcon(
- WindowPtr theWindow
- );
-
- /*
- * User identity and AOCE utilities.
- */
- void SetSpecificIdentity(
- register BrowserPtr browserPtr
- );
- OSErr SystemSupportsAOCE(void);
-
- void ClearMemory(
- register void *recordPtr,
- register Size recordSize
- );
- #define CLEAR(what) ClearMemory(&what, sizeof what)
- void ErrorAlert(
- short alrtResId,
- OSErr errorValue,
- ConstStr255Param errorText
- );
- /*
- * Cheap 'n dirty pascal string copy routine.
- */
- #define pstrcpy(dst, src) do { \
- StringPtr _src = (src); \
- BlockMove(_src, dst, _src[0] + 1); \
- } while (0)
- /*
- * Cheap 'n dirty pascal string concat.
- */
- #define pstrcat(dst, src) do { \
- StringPtr _dst = (dst); \
- StringPtr _src = (src); \
- short _len; \
- _len = 255 - _dst[0]; \
- if (_len > _src[0]) _len = _src[0]; \
- BlockMove(&_src[1], &_dst[1] + _dst[0], _len); \
- _dst[0] += _len; \
- } while (0)
- #define appendchar(dst, ch) ((dst)[++((dst)[0]) & 0xFF] = (ch))
- #define width(r) ((r).right - (r).left)
- #define height(r) ((r).bottom - (r).top)
-
- /*
- * Dialog Management
- */
- void PositionDialog(
- ResType dialogType,
- short dialogID
- );
- void PositionRect(
- Rect *boundsPtr
- );
-
- /*
- * Global definitions
- */
- EXTERN MenuHandle gAppleMenu;
- EXTERN MenuHandle gFileMenu;
- EXTERN MenuHandle gEditMenu;
- EXTERN Boolean gQuitNow;
- EXTERN Boolean gUpdateMenusNeeded;
- EXTERN EventRecord gEventRecord;
- #define EVENT (gEventRecord)
- EXTERN BrowserPtr gCurrentBrowser;
- EXTERN ListHandle gCurrentLog;
- EXTERN short gOpenWindowCount;
- EXTERN Str255 gFailureLocation;
- EXTERN Boolean gFindInProgress;
- /*
- * Gestalt responses
- */
- EXTERN Boolean gSystemHasBalloonHelp;
- EXTERN Boolean gHasColorQuickDraw;
- EXTERN Boolean gHasPopupCDEF;
- EXTERN Boolean gHasAOCEToolbox;
-
-
- #endif /* Not REZ */
- /*
- * The following information is common to the application
- * and the Rez source.
- */
- #endif /* _AddressOMaticTest_ */
-